local skill = fk.CreateSkill {
  name = "lvshi__lingwei",
}

Fk:loadTranslationTable{
  ["lvshi__lingwei"] = "凌威",
  [":lvshi__lingwei"] = "你可将红色牌当任意【杀】使用或打出，你可将【杀】当【水淹七军】使用。",

  ["$lvshi__lingwei1"] = "来将通名，关某刀下不斩无名之鬼！",
  ["$lvshi__lingwei2"] = "卖首之贼，关某面前岂容你放肆！",
}
local U = require "packages/utility/utility"

skill:addEffect("viewas", {
  pattern = "slash,drowning",
  interaction = function(self)
    local all_names = {"slash", "drowning"}
    local invoke_names = table.filter(Fk:getAllCardNames("bt"), function (name)
      return table.contains(all_names, Fk:cloneCard(name).trueName)
    end)
    return UI.CardNameBox {choices = invoke_names}
  end,
  card_filter = function(self, player, to_select, selected)
    if not self.interaction.data then return end
    if string.find(self.interaction.data, "drowning") then
      return #selected == 0 and Fk:getCardById(to_select).trueName == "slash"
    elseif string.find(self.interaction.data, "slash") then
      return #selected == 0 and Fk:getCardById(to_select).color == Card.Red
    end
  end,
  view_as = function(self, player, cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard(self.interaction.data)
    card:addSubcards(cards)
    card.skillName = skill.name
    return card
  end,
})

return skill